//: src/com/silvtar/net/message.java
/* 
 * Created by 朴晟宁 <piaosn@gmail.com> on 5/25/2013. 
 * Copyright (c) 2013 朴晟宁. All rights reserved.
 * 
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program;
 * 
 * Modify History:
 * Date        Version    Description
 * 5/25/2013   0.1        Create The Class
 */
package com.silvtar.net;

import java.io.Serializable;

/**
 * 消息类。
 * @author 朴晟宁/Silvtar
 * @author piaosn@gmail.com
 * @version 0.1
 */
public class Message implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    // 常量——消息类型
    public final static int   VALIDATE         = 1;
    public final static int   SUCCESS          = 2;
    public final static int   FAIL             = 3;
    public final static int   DOWNLOAD         = 4;
    public final static int   UPLOAD           = 5;
    public final static int   RESULT           = 6;
    public final static int   COMMAND          = 7;
    public final static int   COMMANDRETURN    = 8;
    public final static int   SYNC             = 9;

    // 内容
    int                       type;                 // 消息类型
    int                       id;                   // 消息编号
    String                    content;              // 消息内容
    Object                    accessory;            // 附加内容

    public Message() {

    }

    public Message(String content, int id, int type) {
        this.type = type;
        this.id = id;
        this.content = content;
    }
    
    public Message(String content, int type, String accessory) {
        this.type = type;
        this.content = content;
        this.accessory = accessory;
    }
    
    public Message(String content, int type) {
        this.type = type;
        this.content = content;
    }

    public int getType() {
        return type;
    }

    public int getId() {
        return id;
    }

    public String getContent() {
        return content;
    }
    
    public Object getAccessory() {
        return accessory;
    }
    
    public void setAccessory(Object accseeory) {
        this.accessory = accseeory;
    }
}
